package kits

import (
	"fmt"
	"strconv"
)

type numberTool struct{}

var Number numberTool

// ParseInt 转换为Int64数字
func (nt *numberTool) ParseInt(num string) int64 {
	if val, err := strconv.ParseInt(num, 10, 64); err == nil {
		return val
	} else {
		panic(fmt.Sprintf("[%v]不是有效的数字", num))
	}
}

// ParseUint 转换为UInt64数字
func (nt *numberTool) ParseUint(num string) uint64 {
	if val, err := strconv.ParseUint(num, 10, 64); err == nil {
		return val
	} else {
		panic(fmt.Sprintf("[%v]不是有效的数字", num))
	}
}
